//
//  STableViewCell.m
//  FangXinLang
//
//  Created by AJY on 16/9/20.
//  Copyright © 2016年 AJY. All rights reserved.
//

#import "STableViewCell.h"
#import "ScrollModel.h"
#import <UIImageView+WebCache.h>
@implementation STableViewCell

- (void)awakeFromNib {
    //
    
    self.scrollview.frame=CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, self.frame.size.height);
}
-(void)headWithPicture:(NSMutableArray *)scM{
    _arr=scM;
    CGFloat w=self.scrollview.bounds.size.width;
    CGFloat h=self.scrollview.bounds.size.height;
    int i=0;
    for (ScrollModel *model in self.arr) {
        
            UIImageView *image=[[UIImageView alloc]initWithFrame:CGRectMake(i*w,0 , w, h)];
        [self.scrollview addSubview:image];
        [image sd_setImageWithURL:[NSURL URLWithString:model.kpic]];
        i++;
    }
    self.scrollview.contentSize=CGSizeMake(self.arr.count*w, 0);
    self.scrollview.pagingEnabled=YES;
    self.pag.currentPage=0;
    self.pag.numberOfPages=self.arr.count;
    self.scrollview.delegate=self;
    ScrollModel *model=self.arr[0];
    self.longtitle.text=model.longTitle;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    NSInteger num=self.scrollview.contentOffset.x/self.scrollview.bounds.size.width;
    self.pag.currentPage=num;
    ScrollModel *model=self.arr[num];
    self.longtitle.text=model.longTitle;
}
+(instancetype)stablecell{
    return [[[NSBundle mainBundle]loadNibNamed:@"STableViewCell" owner:nil options:nil]lastObject];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
